import {tempLicenseEnter,tempLicenseRegister} from "../api/myCar/index.js"
export default {
	data() {
		return {
			parkName: '', // 车场名称
			portName: '', // 入口名称
			enterTime: '', // 识别时间
			portId: '', // 入口id
			plateNumber: '' ,// 系统生成临时车牌
			options:{},//页面参数
		}
	},
	onLoad(option) {
		this.enterTime = this.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM:ss');
		this.options = option
	},
	async onReady(){
		let option = this.options
		this.getcanshu(option)
	},
	methods: {
		async fetchSomething(option){
			this.getcanshu(option)
		},
		getcanshu(option){
			if (option.portId) {
				this.portId = option.portId
				this.parkName = option.parkName
				this.portName = option.portName
				// 车牌登记进场
				this._registPlate()
			}
		},
		/**
		 * 点击确认进场
		 */
		async handleSubmit() {
			const param = { portId: this.portId }
			let res = await tempLicenseEnter(param)
			if(!res) return
			this.plateNumber = res.data || ''
		},
		async _registPlate() {
			const param = { portId: this.portId }
			let res = await tempLicenseRegister(param)
		}
	}
}